from django.conf.urls import url
from rest_framework_jwt.views import obtain_jwt_token

from meiduo_admin.admin import admin_views
from meiduo_admin.brand import brand_views
from meiduo_admin.channel import channel_views
from meiduo_admin.group import group_views
from meiduo_admin.home import home_views
from meiduo_admin.image import image_views
from meiduo_admin.option import option_views
from meiduo_admin.order import order_views
from meiduo_admin.permission import permission_views
from meiduo_admin.spec import spec_views
from meiduo_admin.spu import spu_views
from meiduo_admin.user import user_views
from rest_framework.routers import DefaultRouter
from meiduo_admin.skus import sku_views

urlpatterns = [
    url(r'^authorizations/$', obtain_jwt_token),
    url(r'^statistical/total_count/$', home_views.UserTotalCountView.as_view()),
    url(r'^statistical/day_increment/$', home_views.UserIncrementView.as_view()),
    url(r'^statistical/day_active/$', home_views.UserActiveView.as_view()),
    url(r'^statistical/month_increment/$', home_views.UserMonthIncrement.as_view()),
    url(r'^statistical/goods_day_views/$', home_views.UserCategoryView.as_view()),
    url(r'^users/$', user_views.UserView.as_view()),
    # sku
    url(r'^skus/categories/$', sku_views.SKUCategories.as_view()),
    url(r'^goods/simple/$', sku_views.GoodSimple.as_view()),
    url(r'^goods/(?P<spu_id>\d+)/specs/$', sku_views.GoodSpecsView.as_view()),
    # sPU
    url(r'^goods/brands/simple/$', spu_views.GoodBrandView.as_view()),
    url(r'^goods/channel/categories/$', spu_views.GoodCategoryView.as_view()),
    url(r'^goods/channel/categories/(?P<cat_id>\d+)/$', spu_views.GoodCategorytwothreeView.as_view()),
    url(r'^goods/images/$', spu_views.GoodImageView.as_view()),
    # spec
    url(r'^goods/specs/simple/$', option_views.OptionSimpleView.as_view()),
    # image
    url(r'^skus/simple/$', image_views.ImageSimpleView.as_view()),
    # channels
    url(r'^goods/channel_types/$', channel_views.ChannelGroupViewSet.as_view()),
    url(r'^goods/categories/$', channel_views.CategoriesViewSet.as_view()),
    # permission.type
    url(r'^permission/content_types/$', permission_views.PermissionContentTypeViewSet.as_view()),
    # permission/simple/
    url(r'^permission/simple/$', group_views.GroupPermissionViewSet.as_view()),
    # permission/groups/simple/
    url(r'^permission/groups/simple/$', admin_views.AdminGroupViewSet.as_view()),

]
# permission/admins
router = DefaultRouter()
router.register('permission/admins', admin_views.AdminModelViewSet, basename='simple')
urlpatterns += router.urls

# permission/groups
router = DefaultRouter()
router.register('permission/groups', group_views.GroupModelViewSet, basename='simple')
urlpatterns += router.urls

# permission/perms
router = DefaultRouter()
router.register('permission/perms', permission_views.PermissionViewSet, basename='permission')
urlpatterns += router.urls

# goods/brands/
router = DefaultRouter()
router.register('goods/brands', brand_views.BrandsViewSet, basename='brands')
urlpatterns += router.urls

# /goods/channels/
router = DefaultRouter()
router.register('goods/channels', channel_views.ChannelsViewSet, basename='channels')
urlpatterns += router.urls

# orders
router = DefaultRouter()
router.register('orders', order_views.OrderViewSet, basename='orders')
urlpatterns += router.urls

# skus/images
router = DefaultRouter()
router.register('skus/images', image_views.ImageViewSet, basename='image')
urlpatterns += router.urls

# specs/options
router = DefaultRouter()
router.register('specs/options', option_views.OptionViewSet, basename='specs')
urlpatterns += router.urls

# specs
router = DefaultRouter()
router.register('goods/specs', spec_views.SPUSpecsViewSet, basename='specs')
urlpatterns += router.urls

# goods
router = DefaultRouter()
router.register('goods', spu_views.SPUModelViewSet, basename='goods')
urlpatterns += router.urls

# sku
router = DefaultRouter()
router.register('skus', sku_views.SKUmodelSet, basename='skus')
urlpatterns += router.urls
